package com.xpgk.mvc.statistic.monthShopManagerAndEmployeeKeyIndex;

import java.util.ArrayList;

import com.jfinal.plugin.activerecord.Record;
import com.xpgk.mvc.base.BaseController;
import com.xpgk.mvc.organization.Organization;

public class MonthShopManagerAndEmployeeKeyIndexController extends BaseController {
	
//	private ScallVisitService scallVisitService = new ScallVisitService();
	
	/*
	 * 月度店长店员(顾客)关键指标页面跳转
	 */
	public void index(){
		setAttr("curOrgan", Organization.dao.findById(getCUserOrganIds()));
		render("monthShopManagerAndEmployeeKeyIndex.html");
	}
	/*
	 * 隶属查询
	 */
	public void query(){
		String organIdsEmployee = getPara("organIdsEmployee");
		String marketingmanager = getPara("marketingmanager");
		String provinces = getPara("provinces");
		String agent = getPara("agent");
		String areamanager = getPara("areamanager");
		String nameofshop = getPara("nameofshop");
		String shopmanager = getPara("shopmanager");
		String nameofclerk = getPara("nameofclerk");
		renderJson(new ArrayList<Record>());
	}
////	/*
////	 * 电话回访条件查询
////	 */
////	public void queryByCustom(){
////		String json = paging(splitPage, scallVisitSQL.scallVisit_splitPageSelect, scallVisitSQL.scallVisit_splitPageFrom);		
////		renderJson(json);
////	}
//	/*
//	 * 回访信息查询
//	 */
//	public void queryByCallVisit(){
//		String customerIds = getPara("customerIds");
//		setAttr("customerIds",customerIds);
//		render("scallVisit3.html");
//	}
//	
//	//电话回访客户信息保存
//	@Before(Tx.class)
//	public void saveVisitCustomer(){ 
//		String  cudid=getCUserOrganIds();
//		ScallVisit scallVisit = getModel(ScallVisit.class);
//		RenderBean result=scallVisitService.saveCallVisit(scallVisit, cudid);
//		renderJson(result);
//	}
//	
//	//回访预览（弹窗）
//	public  void showscallVisit(){	
//		String  cusIds=getPara("customerIds");
//		Customer  cus=Customer.dao.findById(cusIds);
//		setAttr("customer", cus);
//		render("scallVisit2.html");
//	}
//	
//	//回访信息查询（查询）
//	public void showscallVisit2(){
//		String json = paging(splitPage, scallVisitSQL.scallVisit_splitPageSelectvisit, scallVisitSQL.scallVisit_splitPageFromvisit);
//		renderJson(json);
//	}
//	/*
//	 * 查询结果导出
//	 */
//	public void excel(){
//		String organIdsEmployee = getPara("organIdsEmployee");
//		String name = getPara("name");
//		String phone = getPara("phone");
//		String arrivedMinDate = getPara("arrivedMinDate");
//		String arrivedMaxDate = getPara("arrivedMaxDate");
//		String minResultLostWeight = getPara("minResultLostWeight");
//		String maxResultLostWeight = getPara("maxResultLostWeight");
//		String arrivedMinTimes = getPara("arrivedMinTimes");
//		String arrivedMaxTimes = getPara("arrivedMaxTimes");
//		String minLostWeightAmount = getPara("minLostWeightAmount");
//		String maxLostWeightAmount = getPara("maxLostWeightAmount");
//		String isSatisfaction = getPara("isSatisfaction");
//		Organization organ = Organization.dao.findById(organIdsEmployee);//门店
//		String search_organIdsEmployee =organ.getStr(Organization.column_name).equals("")?"":("店面名称："+organ.getStr(Organization.column_name)+"，");
//		String search_name = name.equals("")?"":(("姓名：")+ name+"，" );
//		String search_phone = getPara("phone").equals("")?"":(("手机号：")+phone+"，");
//		String search_arrivedMinDate = getPara("arrivedMinDate").equals("")?"":(("最早到店日期：")+arrivedMinDate+"，");
//		String search_arrivedMaxDate = getPara("arrivedMaxDate").equals("")?"":(("最晚到店日期：")+arrivedMaxDate+"，");
//		String search_minResultLostWeight = getPara("minResultLostWeight").equals("")?"":(("最小减重效果：")+minResultLostWeight+"，");
//		String search_maxResultLostWeight = getPara("maxResultLostWeight").equals("")?"":(("最大减重效果：")+maxResultLostWeight+"，");
//		String search_arrivedMinTimes = getPara("arrivedMinTimes").equals("")?"":(("最少到店次数：")+arrivedMinTimes+"，");
//		String search_arrivedMaxTimes = getPara("arrivedMaxTimes").equals("")?"":(("最多到店次数：")+arrivedMaxTimes+"，");
//		String search_minLostWeightAmount = getPara("minLostWeightAmount").equals("")?"":(("最小减重斤数：")+minLostWeightAmount+"，");
//		String search_maxLostWeightAmount = getPara("maxLostWeightAmount").equals("")?"":(("最大减重斤数：")+maxLostWeightAmount+"，");
//		String search_isSatisfaction = "";
//		if(isSatisfaction!=""){
//			if(isSatisfaction.equals("1")){
//				search_isSatisfaction="满意";
//			}else if(isSatisfaction.equals("2")){
//				search_isSatisfaction="一般";
//			}else if(isSatisfaction.equals("3")){
//				search_isSatisfaction="差";
//			}
//		}
//		search_isSatisfaction = search_isSatisfaction.equals("")?"":("满意度："+search_isSatisfaction+"，");
//		String search = search_organIdsEmployee+search_name+search_phone+search_arrivedMinDate+search_arrivedMaxDate+search_minResultLostWeight+search_maxResultLostWeight+search_arrivedMinTimes+search_arrivedMaxTimes+search_minLostWeightAmount+search_maxLostWeightAmount+search_isSatisfaction;
//		SplitPage splitPage2 = new SplitPage();
//		Map<String, Object> param = new HashMap<String, Object>();
//		param.put("organIdsEmployee",organIdsEmployee );
//		param.put("name",name );
//		param.put("phone",phone );
//		param.put("minResultLostWeight",minResultLostWeight );
//		param.put("maxResultLostWeight",maxResultLostWeight );
//		param.put("arrivedMinDate",arrivedMinDate );
//		param.put("arrivedMaxDate",arrivedMaxDate );
//		param.put("arrivedMinTimes",arrivedMinTimes );
//		param.put("arrivedMaxTimes",arrivedMaxTimes );
//		param.put("minLostWeightAmount",minLostWeightAmount );
//		param.put("maxLostWeightAmount",maxLostWeightAmount );
//		param.put("isSatisfaction",isSatisfaction );
//		splitPage2.setQueryParam(param);
//		splitPage2.setPageSize(ConstantSplitPage.default_maxSize);
//		String json = paging(splitPage2, scallVisitSQL.scallVisit_splitPageSelect, scallVisitSQL.scallVisit_splitPageFrom);
//		List<Record> list = (List<Record>)splitPage2.getList();
//		for(Record r : list){
//			Long issatisfaction = r.getLong("issatisfaction");
//			if(issatisfaction!=null){
//				if(issatisfaction==1){
//					r.set("issatisfaction","满意");
//				}else if(issatisfaction==2){
//					r.set("issatisfaction","一般");
//				}else if(issatisfaction==3){
//					r.set("issatisfaction", "差");
//				}
//			}
//			double nowweight = Double.parseDouble(r.get("nowweight").toString());
//			double weight = Double.parseDouble(r.get("weight").toString());
//
//			double reducedWeight = nowweight-weight;
//			r.set("reducedWeight", reducedWeight);
//			double delweight = Double.parseDouble(r.get("delweight").toString());
//			double resultWeight2 = reducedWeight*100/delweight;
//			BigDecimal bg = new BigDecimal(resultWeight2);  
//            double resultWeight = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
//			r.set("resultWeight", resultWeight);
//		}
//		render(new ScallVisitXLS((List<Record>)splitPage2.getList(), "电话回访查询导出",search));
//	}
	
}
